home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0036_VGA Tricks.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  93 lines

  1. {
  2. Sorry it took so long - anyway here's a new batch of VGA TRICKS :
  3. First there's your basic equipment - synchronizing with
  4. the vertical Crt retrace.
  5. ( You can use this For hardware VGA scrolling synchronisation too, just
  6. substitute the Delay(14) in my old routine For a call to this
  7. Procedure.)
  8. }
  9.  
  10. Procedure VRET;Assembler; {works For CGA,EGA and VGA cards}
  11. Asm
  12.   MOV  DX, $03DA
  13.   MOV  AH, 8
  14. @Wau: in   AL, DX
  15.   TEST AL, AH
  16.   JNZ  @Wau     { wait Until out of retrace }
  17. @Wai: in   AL, DX
  18.   TEST AL, AH
  19.   JZ   @Wai     { wait Until inside retrace }
  20. end
  21.  
  22. {
  23. The following is Really new, as Far as I know: breaking the color
  24. barrier by displaying more than 64 different colors on a Text mode
  25. screen. (But it will work For Text and Graphics color modes.)
  26. It displays the effect For approximately SEC seconds, affecting
  27. the black background and any black Characters. note that if
  28. you have the border set to black too, the bars will expand into it.
  29. }
  30.  
  31. Procedure ColorBars(Sec:Byte);Assembler;
  32. Asm
  33.   MOV AL,Sec
  34.   MOV AH,70      { assume a 70 Hz mode (= 400 lines like mode 3 or $13)}
  35.   MUL AH
  36.   MOV CX,AX
  37.   MOV DX,$03DA
  38.   in AL,DX
  39.   MOV DX,$03C0   { assume color nr 0 = default Text background.. }
  40.   MOV AL,$20+0   { set color nr 0 .. }
  41.   OUT DX,AL
  42.   MOV AL,0       { .. to DAC color 0 }
  43.   OUT DX,AL
  44. @Doscreen:
  45.   xor SI,SI
  46.   CLI
  47.   MOV DX,$03DA
  48.   MOV AH,8
  49. @Wau: in AL,DX
  50.   TEST AL,AH
  51.   JNZ @Wau       { wait Until out of retrace }
  52. @Wai: in AL,DX
  53.   TEST AL,AH
  54.   JZ @Wai        { wait Until inside retrace }
  55. @Doline:
  56.   STI
  57.   MOV DX,$03C8  { point to DAC[0] }
  58.   MOV AL,0
  59.   OUT DX,AL
  60.   inC SI        { line counter }
  61.   MOV BX,SI
  62.   ADD BX,CX     { prepare For color effect }
  63.   MOV DI,$03C9
  64.   CLI
  65.   MOV DX,$03DA
  66. @Whu: in AL,DX
  67.   RCR AL,1
  68.   JC @Whu       { wait Until out of horizontal retrace }
  69. @Whi: in AL,DX
  70.   RCR AL,1
  71.   JNC @Whi      { wait Until inside retrace }
  72.   MOV DX,DI
  73.   XCHG BX,AX  { tinker With these to change the chromatic effect}
  74.   OUT DX,AL   { dynamic Red }
  75.   ADD AL,AL
  76.   OUT DX,AL   { dynamic Green }
  77.   XCHG SI,AX
  78.   OUT DX,AL   { static Blue }
  79.   XCHG SI,AX
  80.   CMP SI,200    { paint 200 lines }
  81.   JBE  @doline
  82.   DEC DX         { last line }
  83.   MOV AL,0       { reset to black For remainder of screen }
  84.   OUT DX,AL
  85.   inC DX
  86.   OUT DX,AL
  87.   OUT DX,AL
  88.   OUT DX,AL
  89.   STI
  90. Loop @Doscreen
  91. end;
  92.  
  93.